package com.shanzhe.eshop.auth.pojo;

import com.baomidou.mybatisplus.annotation.TableName;
import com.shanzhe.eshop.common.util.AbstractObject;
import com.shanzhe.eshop.common.util.BeanCopierUtils;
import lombok.Data;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @Author yinwei
 * @create 2021/10/2
 * @Version 1.0
 * @desc 权限DTO类
 */
@Data
public class AuthPriorityDTO extends AbstractObject {

    private static final Logger logger = LoggerFactory.getLogger(AuthPriorityDTO.class);

    /**
     * 权限编号
     */
    private String code;

    /**
     * 权限url
     */
    private String url;

    /**
     * 权限备注
     */
    private String priorityComment;

    /**
     * 权限类型 1：菜单，2：其他
     */
    private Integer priorityType;

    /**
     * 父权限的主键
     */
    private Long parentId;

    /**
     * 克隆方法
     * @param clazz 目标class对象
     * @return 克隆后的对象
     */
    @Override
    public <T> T clone(Class<T> clazz){
        T target = null;
        try {
            target= clazz.newInstance();
        }catch (Exception e){
            logger.error("AuthPriorityDO克隆对象有误",e.getMessage());
            e.printStackTrace();
        }
        BeanCopierUtils.copyProperties(this,target);
        return target;
    }
}
